<template>
  <SearchSelectPicker
    url="/call-center/api/v1/staffInfo/page"
    :placeholder="placeholder"
    lable-name="staffName"
    :value-name="valueName"
    :value.sync="staff"
    :lable.sync="label"
    :disabled="disabled"
    :params="params"
  ></SearchSelectPicker>
</template>
<script>
import SearchSelectPicker from '@/components/SearchSelectPicker'
export default {
  name: 'StaffSearch',
  components: {
    SearchSelectPicker
  },
  props: {
    value: {
      type: [String, Number],
      default: ''
    },
    name: {
      type: [String],
      default: ''
    },
    placeholder: {
      type: [String, Number],
      default: ''
    },
    valueName: {
      type: [String, Number],
      default: 'accountNo'
    },
    disabled: {
      type: [Boolean],
      default: false
    },
    params: {
      // 请求参数,query参数，type方式（msc post分页区分 1）
      type: Object,
      default: () => {
        return { query: null, type: 0 }
      }
    }
  },
  data() {
    return {
      staff: '',
      label: ''
    }
  },
  watch: {
    staff: {
      handler: function(v) {
        this.$emit('input', v)
        if (!v) {
          this.label = ''
        }
      }
      // immediate: true
    },
    label: {
      handler: function(v) {
        this.$emit('update:name', v)
      }
      // immediate: true
    },
    value: {
      handler(n) {
        this.staff = n
      },
      immediate: true
    },
    name: {
      handler(n) {
        this.label = n
      },
      immediate: true
    }
  }
}
</script>
<style lang='scss' module>
.wrap{

}
</style>
